<%@ Language=VBScript %>
<%Option Explicit%>

<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->

<%
	response.CacheControl = "no-cache"
	Dim oConn, sSQL, oRS
	Dim IdCurso, IdMateria
	
	IdCurso = request("IdCurso")
	IdMateria = request("IdMateria")
	if IdMateria <> "TODAS" then
		IdMateria = cint(IdMateria)
	end if
	Set oConn = OpenConnection
	
	sSQL=	"select M.IdMateria, M.MateriaDesc from Materia M " & _
			"inner join MateriasCurso MC on (MC.IdCurso in (" & IdCurso & ")) " & _
			"inner join ProfesorMaterias PM on (PM.IdProfesorMateria = MC.IdProfesorMateria and PM.IdMateria = M.IdMateria) " & _
			"order by MateriaDesc"
	'response.write ssql
	'response.end
	Set oRS = oConn.Execute(sSQL)

	response.Write "<select id=""cmb_Materias"" style=""font-family: Verdana; font-size: 10px;"" onchange=""GetChart(this.value, cmb_Cursos.value, cmb_Trimestres.value); GetListadoAlumnos(this.value, cmb_Cursos.value, cmb_Trimestres.value); IdMateria = this.value;"">"
	'response.Write "<option value='TODAS'>TODAS</option>"
	Dim iprimero
	while not oRS.EOF
		response.Write "<option value='" & oRS("IdMateria") & "'"
		if oRS("IdMateria") = IdMateria then
			response.Write " selected"
		end if
		response.Write ">"
		response.Write server.HTMLEncode(oRS("MateriaDesc"))
		response.Write "</option>"
		oRS.MoveNext()
	wend
	response.Write "</select>"
%>